Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Conversation

emmanuellujan
Copy link
Contributor

No description provided.

@emmanuellujan emmanuellujan changed the title Advances in issue 355 [WIP] Progress on upwindig rules (issue 355) May 11, 2021
@emmanuellujan
Copy link
Contributor Author

So far, cases like the following can be parsed and solved:

  • Dt(u(t,x)) ~ -Dx(u(t,x))
  • Dt(u(t,x)) ~ Dx(u(t,x))
  • Dt(u(t,x)) ~ -c * Dx(u(t,x))
  • Dt(u(t,x)) ~ -Dx(u(t,x)) + cosh(x)^2 - sinh(x)^2 - 1

All these cases use Dirichlet BCs.

@valentinsulzer
Copy link
Contributor

valentinsulzer commented May 27, 2021

How's this going @emmanuellujan ? Let me know if you need help resolving conflicts. I didn't change anything around the lines you changed, just indented

@emmanuellujan
Copy link
Contributor Author

I have been working on other projects. Next week I can resume this PR, and resolve these conflicts :-)

Copy link
Contributor

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty sensible so far. Note #405 took care of the IntervalDomain/Interval change

# *(~~a..., ~~b..., dot(reverse_weights(II,j),depvars[k][central_neighbor_idxs(II,j)[1:2]])),
# *(~~a..., ~~b..., dot(forward_weights(II,j),depvars[k][central_neighbor_idxs(II,j)[2:3]]))))
# for j in 1:nspace, k in 1:length(pdesys.depvars)]
upwinding_rules_tmp = [@rule(*(~~a,$(Differential(iv)),~~b) => IfElse.ifelse(*(~~a..., ~~b...,)>0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ifelse will work if a and b can be evaluated. But what if they are dependent variables (e.g. velocity in Navier-Stokes)?

forward_weights(II,j) = DiffEqOperators.calculate_weights(discretization.upwind_order, 0.0, grid[j][[II[j],II[j]+1]])
#forward_weights(II,j) = -1.0 * reverse_weights(II,j) # TODO: check this function
side = 1.0
upwinding_rules_tmp = [@rule(*(~~a,$(Differential(iv))(dv),~~b) => Base.ifelse(*(side, ~~a..., ~~b...,)>0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to flip, I think you need @acrule @shashi ?

@emmanuellujan
Copy link
Contributor Author

Hi @shashi, I need to create a rule like the following:

@rule *(~~a, $(Differential(r))(u(x)), ~~b) => "success"

where ~~a and ~~b are numbers or nothing. Thus, I want to apply the rule here (-1.0+3.0) * Dx(u(x)) * 2.0 or here Dx(u(x)) * 2.0, but not here -1.0 * Dx(u(x)) * v(x)
Could you help me? Thank you :)

@shashi
Copy link

shashi commented Jul 16, 2021

@YingboMa instead of using rule can we use something to get the coefficient of Differential(r))(u(x) here?

@shashi
Copy link

shashi commented Jul 16, 2021

    (a, b, islinear) = linear_expansion(t, x)

When `islinear`, return `a` and `b` such that `a * x + b == t`.

but not here -1.0 * Dx(u(x)) * v(x)

I don't get how this is different...

@emmanuellujan
Copy link
Contributor Author

but not here -1.0 * Dx(u(x)) * v(x)

I don't get how this is different...

v(x) needs to be evaluated to get a value, but -1.0 is directly a parameter

@ChrisRackauckas
Copy link
Member

Do you intend to finish this this week or is it just cookie licking now?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants